
#include <functional>
#include <iostream>

#include <conio.h>

#include "glare.d3d11.Driver.h"
#include "glare.gles2.Driver.h"

using namespace Glare;

int main()
{
	Driver* driver;

	try
	{
		DriverFactory factory;
		factory.RegisterFactory(D3D11Driver::Name, [&](){ return new D3D11Driver(); });
		factory.RegisterFactory(GLES2Driver::Name, [&](){ return new GLES2Driver(); });

		auto driver_names = factory.GetKeys();

		std::for_each(driver_names.begin(), driver_names.end(), [&](string name)
		{
			driver = factory.Create(name);

			std::cout << "Driver " << driver->GetName() << std::endl;
			std::cout << " RenderStages: " << std::endl;

			for (DriverStage::Type i = DriverStage::Min; i <= DriverStage::Max; i = (DriverStage::Type)(i << 1))
			{
				bool supported = driver->IsPipelineStageSupported(i);
				std::cout << "  has " << DriverStage::ToString(i) << (supported ? ": Yes" : ": No") << std::endl;
			}

			delete driver;
		});
	}
	catch (Exception e)
	{
		MessageBox(0, e.what(), 0, 0);
	}

	getch();
	return 0;
}
